package com.woniuxy.controller;

import com.woniuxy.entity.dto.AddressManagementDTO;
import com.woniuxy.entity.dto.PartnerDTO;
import com.woniuxy.service.PartnerService;
import com.woniuxy.util.PageData;
import com.woniuxy.util.ResponseData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/partner")
public class PartnerManagementController {

    @Resource
    private PartnerService partnerService;

    @PostMapping("/queryAllPartner")
    public ResponseData<?> queryAllPartner(@RequestBody PageData<PartnerDTO> pageData) {
        return partnerService.queryAllPartner(pageData);
    }

    @PostMapping("/addPartnerBtn")
    public ResponseData<?> addPartnerBtn(@RequestBody PartnerDTO partnerDTO) {
        return partnerService.addPartner(partnerDTO);
    }

    @PostMapping("/saveUpdatePartner")
    public ResponseData<?> saveUpdatePartner(@RequestBody PartnerDTO partnerDTO) {
        return partnerService.updatePartner(partnerDTO);
    }

    @PostMapping("/updateStatus")
    public ResponseData<?> updateStatus(@RequestBody PartnerDTO partnerDTO) {
        return partnerService.updateStatus(partnerDTO);
    }
    @PostMapping("/batchUpdateStatus1")
    public ResponseData<?> batchUpdateStatus1(@RequestBody List<PartnerDTO> partnerDTOS) {
        return partnerService.batchUpdateStatus1(partnerDTOS);
    }
    @PostMapping("/batchUpdateStatus0")
    public ResponseData<?> batchUpdateStatus0(@RequestBody List<PartnerDTO> partnerDTOS) {
        return partnerService.batchUpdateStatus0(partnerDTOS);
    }
}
